from launch import LaunchDescription
from launch_ros.actions import Node
from ament_index_python.packages import get_package_share_directory
import os


def generate_launch_description():
    param = [{"scan_line": 32, "mapping_skip_frame": 1, "minimum_range": 1.0,
              "mapping_line_resolution": 0.4, "mapping_plane_resolution": 0.8}]
    remappings = [("/velodyne_points", "/rslidar_points")]
    rviz_dir = get_package_share_directory("aloam_ros2")+"/rviz_cfg/aloam_velodyne.rviz"
    return LaunchDescription([
		                      Node(package="tf2_ros", executable="static_transform_publisher", arguments=["--frame-id", "aft_mapped", "--child-frame-id", "rslidar"]),
                              Node(package="aloam_ros2", remappings=remappings,
                                   executable="alaserOdometry", parameters=param, output="screen"),
                              Node(package="aloam_ros2", remappings=remappings,
                                   executable="alaserMapping", parameters=param, output="screen"),
                              Node(package="aloam_ros2", executable="ascanRegistration", remappings=remappings,
                                   parameters=param, output="screen")])
